package com.wsx.five;

import java.util.*;

/**
 * Created by wangshunxi on 2022/6/19.
 * e-mail: wsr12240512@163.com
 * phone: 13388071923
 */
public class Main0002 {
    public static void main(String[] args) {
        String str = "good";
        int count = 1;
        List<String> result = new ArrayList<>();
        int total = 0;
        while (count <= str.length()) {
            total += importD(result, count, str);
            count++;
        }
        System.out.println(total);
        for (int i = 0; i < result.size(); i++) {
            System.out.println(result.get(i));
        }


    }

    private static int importD(List<String> result, int count, String str) {
        int re = 0;
        for (int i = 0; i < str.length() - count+1; i++) {
            String substring = str.substring(i, i + count);
            char[] chars = substring.toCharArray();
            Set<Character> strings = new HashSet<>();
            for (int j = 0; j < chars.length; j++) {
                strings.add(chars[j]);
            }
            re += strings.size();
            result.add(substring);
        }
        return re;
    }


}
